package view;

import common.Car;
import gui.G;

public class Boundary {
	
	public static String getString(String message) {
		return G.getUserString(message);
	}
	public static int getInt(String message, String errormessage) {
		String enteredString = "";
		int enteredNumber = 0;
		boolean isOK = false;
		while(!isOK) {
			enteredString = G.getUserString(message + " " + errormessage);
			try {
				enteredNumber = Integer.parseInt(enteredString);
				if(enteredNumber > 0) {
					isOK = true;
				}
			} catch(NumberFormatException ex) {
				ex.printStackTrace();
			}
		}
		return enteredNumber;
	}
	public static boolean getYesNo(String message) {
		String[] options = {"Yes", "No"};
		String selection = G.getUserButtonPressed(message, options);
		if(options[0].equals(selection))
			return true;
		return false;
	}
	public static void showMessage(String message) {
		G.showMessage(message);
	}
	public static String getPressedButton(String message, String... buttons) {
		return G.getUserButtonPressed(message, buttons);
	}
	public static String getSelection(String message, String... strings) {
		return G.getUserDropDownSelection(message, strings);
	}
	public static synchronized void close() {
		G.close();
	}
	public static void setTitleText(int fieldNumber, String title) {
		G.setTitleText(fieldNumber, title);
	}
	public static void setSubText(int fieldNumber, String subText) {
		G.setSubText(fieldNumber, subText);
	}
	public static void setDescriptionText(int fieldNumber, String description) {
		G.setDescriptionText(fieldNumber, description);
	}
	public static void addPlayer(String name, int balance) {
		G.addPlayer(name, balance);
	}
	public static void addPlayer(String name, int balance, Car car) {
		G.addPlayer(name, balance, car);
	}
	public static void setBalance(String name, int newBalance) {
		G.setBalance(name, newBalance);
	}
	public static void setDice(int faceValue1, int faceValue2) {
		G.setDice(faceValue1, faceValue2);
	}
	public static void setChanceCard(String txt) {
		G.setChanceCard(txt);
	}
	public static void displayChanceCard() {
		G.displayChanceCard();
	}
	public static void setCar(int fieldNumber, String name) {
		G.removeAllCars(name);
		G.setCar(fieldNumber, name);
	}
	public static void removeCar(String name) {
		G.removeAllCars(name);
	}
	public static void setOwner(int fieldNumber, String prefix, String name, String postfix) {
		G.setOwner(fieldNumber, prefix, name, postfix);
	}
	public static void removeOwner(int fieldNumber) {
		G.removeOwner(fieldNumber);
	}
	public static void setHouses(int fieldNumber, int houseCount) {
		G.setHouses(fieldNumber, houseCount);
	}
	public static void setHotel(int fieldNumber, boolean hasHotel) {
		G.setHotel(fieldNumber, hasHotel);
	}
}